import java.io.File;
import java.io.IOException;

/*
 *      GameLoader.java
 *      
 *      Copyright 2011 Navin Shajan <>
 * 
 * 		runs Game.java with some gc flags.
 */

public class GameLoader {

	public static void main(final String args[]) {
		//ProcessBuilder p = new ProcessBuilder();
		final String[] flagsArr = {
				"-XX:+AggressiveOpts ",
				"-XX:CompileThreshold=10000 ",
				"-XX:+UseFastAccessorMethods ",
				"-XX:+UseStringCache ",
				"-XX:+OptimizeStringConcat ",
				"-XX:MaxInlineSize=35" 
		};
		String flags = "";
		String readableFlags = "";
		for (final String flag : flagsArr) {
			flags += flag;
			readableFlags += flag + "\n";
		}
		System.out.println("\n\n Loading game with flags:\n" + readableFlags
				+ "\n");
		try {
			Runtime.getRuntime()
					.exec("java " + flags + " Game -noLoader",
							null,
							System.getProperty("os.name").equals("Windows 7") ? new File(
									"bin/") : null);
		} catch (final IOException ioe) {
			ioe.printStackTrace();
		}
	}
}